import { regionCodes, regionData } from './regionData';
import pickerOptions from './pickerOptions';
/**
 *
 * @param {Function} cb 回调函数
 */
function regionPickerOptions(cb) {
  return pickerOptions(regionData, (aeras, index) => {
    const [first, second, third] = index;
    const { id: proviceId, children: citys } = regionCodes[first];
    const { id: cityId, children: regions } = citys[second];
    const { id: aeraId } = regions[third];

    const region = { ids: [proviceId, cityId, aeraId], aeras };
    cb(region);
  });
}

export default regionPickerOptions;
